import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/index',
    name: 'App',
    component: () => import('@/views/layout/index'),
    children: [
      {
        path: 'index',
        name: 'Index',
        component: () => import('@/views/index/index')
      },
      {
        path: 'manager',
        redirect: '/manager/info',
        name: 'Manager',
        component: () => import('@/views/manager/index'),
        children: [
          {
            path: 'info',
            name: 'Info',
            component: () => import('@/views/manager/info')
          },
          {
            path: 'comment',
            name: 'Comment',
            component: () => import('@/views/manager/comment')
          },
          {
            path: 'collection',
            name: 'Collection',
            component: () => import('@/views/manager/collection')
          }
        ]
      },
      {
        path: 'type',
        name: 'Type',
        component: () => import('@/views/type/index')
      },
      {
        path: 'about',
        name: 'About',
        component: () => import('@/views/about/index')
      },
      {
        path: 'info/:id',
        name: 'Info',
        component: () => import('@/views/blog/info')
      },
      {
        path: 'search/:blogTitle',
        name: 'Search',
        component: () => import('@/views/blog/search')
      },
      {
        path: 'blogList',
        name: 'Info',
        component: () => import('@/views/blog/blog-list')
      },
      {
        path: 'time-line',
        name: 'TimeLine',
        component: () => import('@/views/time-line/index')
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login/index')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('@/views/admin/register')
  },
  {
    path: '/qqauth',
    name: 'qqAuth',
    component: () => import('@/views/qqauth/index')
  },
  {
    path: '/admin-register',
    name: 'AdminRegister',
    component: () => import('@/views/admin/admin-register')
  }

]

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
